package top.lvkun.product.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.lvkun.basic.utils.PageList;
import top.lvkun.product.domain.Product;
import top.lvkun.product.query.ProductQuery;
import top.lvkun.product.service.IProductService;

@RestController
@RequestMapping("/front/product")
public class FrontProductController {
    @Autowired
    private IProductService productService;

    /**
     * 前台展示已上架的产品   分页查询+ 高级条件查询
     * @param productQuery
     * @return
     */
    @PostMapping
    public PageList<Product> pageList(@RequestBody ProductQuery productQuery){
         return productService.queryData(productQuery);
    }


    /**
     * 通过id查询产品信息(包括产品详细信息)
     * @param id
     * @return
     */
    @GetMapping("{id}")
    public Product getById(@PathVariable("id") Long id){
        return productService.getById(id);
    }





}
